package com.ruoyi.web.controller.system;
/**
 * ClassName: SysMsgController <br/>
 * Description: <br/>
 * date: 2020/3/26 9:19<br/>
 *
 * @author Hesion<br />
 * @version
 * @since JDK 1.8
 */

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.system.domain.Message;
import com.ruoyi.system.domain.SysNews;
import com.ruoyi.system.service.IMsgService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @program: ruoyi
 * @description:
 * @author: hesion
 * @create: 2020-03-26 09:19
 **/
@Controller
@RequestMapping("/system/message")
public class SysMsgController extends BaseController {
String prefix = "system/message";
@Autowired
    IMsgService msgService;
    @GetMapping()
    public String taskPage() {
        return prefix + "/message";
    }

    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(Message message) {
        startPage();
        List<Message> list = msgService.selectMsgList(message);
        return getDataTable(list);
    }

    @PostMapping("/remove/{id}")
    @ResponseBody
    public AjaxResult remove(@PathVariable String id){
        Integer remove=msgService.remove(id);
        if(remove>0){
            return AjaxResult.success("删除成功!");
        }else {
            return AjaxResult.error("删除失败!");
        }
    }
}
